package com.gd.luxiaoyu.moduels.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gd.luxiaoyu.Constant;
import com.gd.luxiaoyu.moduels.entity.InformTableEntity;
import com.gd.luxiaoyu.moduels.service.InformTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("right/informtable")
public class InformTableController {
    @Autowired
    private InformTableService informTableService;
    Constant constant = new Constant();
    /**
     * 列表
     */
  @RequestMapping("/list")
  @ResponseBody
    public Map<String ,Object> list(Page<InformTableEntity> informTableEntityPage ,InformTableEntity informTableEntity){
      IPage<InformTableEntity> page = informTableService.getAllInfo(informTableEntityPage,informTableEntity);
      Map<String,Object> map = new HashMap<>();
      map.put("toals",page.getTotal());
      map.put("rows",page.getRecords());
        return map;
    }

     /*
     * 通过用户id查询举报信息
     * */
     /*public List<InformTableEntity> queryByUserId(InformTableEntity informTableEntity){
         List<InformTableEntity> informTableEntitylist =  informTableService.getById()//.getById(informTableEntity.getUid());
     }*/
    /*
     * 通过开发商id查询举报信息
     * */
     /*public List<InformTableEntity> queryByCustomerId(InformTableEntity informTableEntity){
         List<InformTableEntity> informTableEntitylist =  informTableService.getById()//.getById(informTableEntity.getUid());
     }*/
     /*

     *通过APPid 删除评论
     * */
     @RequestMapping("/delete")
     @ResponseBody
     public R<?> delete(InformTableEntity informTableEntity){
         boolean delete = informTableService.removeById(informTableEntity.getId());
         return  delete ? R.ok(constant.SUCCESSFUL) :R.failed(constant.FAIL);
     }
    @RequestMapping("/save")
    @ResponseBody
    public R<?> save(InformTableEntity informTableEntity){
        boolean save = informTableService.save(informTableEntity);
        return  save ? R.ok(constant.SUCCESSFUL) :R.failed(constant.FAIL);
    }

}
